package modes

/*省市区数据*/
type CityData struct {
	Id   int64  `json:"id" xorm:"id"`     //省市区id
	PId  int64  `json:"p_id" xorm:"p_id"` //父级城市id
	Name string `json:"name" xorm:"name"` //城市名称
}

func (this *CityData) TableName() string {
	return "citydata"
}
func (this *CityData) Save() (int64, error) {
	return Db(0).Insert(this)
}

func (this *CityData) List(where string) ([]CityData, error) {
	list := make([]CityData, 0)
	err := Db(0).Where(where).Asc("name").Find(&list)
	return list, err
}
